package cn.signalpha.modules.shop.controller.api;

import cn.signalpha.common.constant.AppConstant;
import cn.signalpha.core.boot.ctrl.BaseController;
import cn.signalpha.core.mp.support.Condition;
import cn.signalpha.core.tool.api.R;
import cn.signalpha.modules.shop.entity.SellerAddress;
import cn.signalpha.modules.shop.service.SellerAddressService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;

import java.util.List;
import java.util.Map;

/**
 * 控制器
 *
 * @author signalpha
 */
@RestController
@AllArgsConstructor
@RequestMapping(AppConstant.APPLICATION_SHOP_NAME + "/wap/seller/address")
@Api(value = "商户地址", tags = "商户地址")
public class ApiSellerAddressController extends BaseController {

	private final SellerAddressService sellerAddressService;

	@GetMapping("/list")
	@ApiOperation(value = "列表", notes = "")
	public R<List<SellerAddress>> list(@ApiIgnore @RequestParam Map<String, Object> params, @RequestParam Long sellerId){
		QueryWrapper<SellerAddress> wrapper = Condition.getQueryWrapper(params, SellerAddress.class);
		wrapper.lambda().eq(SellerAddress::getSellerId, sellerId);
		return R.data(sellerAddressService.list(wrapper));
	}

}
